package service;

import dao.IEmpDao;
import dao.impl.EmpDaoImpl;
import pojo.Emp;

import java.util.ArrayList;

public class EmpServiceImpl implements IEmpService {
    private IEmpDao ied = new EmpDaoImpl();

    @Override
    public Emp Login(Emp emp) {
        ArrayList<Emp> emps = ied.selectByEmpnoAndEname(emp);
        if(!emps.isEmpty()){//如果不是空
//        if(emps.size()>0){
            return emps.get(0);
        }else {
            return null;
        }
    }

    @Override
    public ArrayList<Emp> queryAll() {
        return ied.selectAll();

    }

    @Override
    public boolean removeByEmpno(int empno) {
        int i = ied.delByEmpno(empno);
        return i>0;
    }
}
